// Sidebar widgets
@import 'config/import';
@import 'variables';
@import '_mixins';

// Sidebar Widgets
.widget {
  position: relative;
  overflow: hidden;
  display: block;
  padding: 0 16px 16px 16px;
  margin: 8px 0 16px 0;
  &:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 1px;
    background: var(--card-color-tertiary);
    opacity: 0.25;
  }

  &.fixed-widget {
    position: sticky;
    width: 254px;
    top: 80px;
    header {
      padding-left: 6px;
    }
  }
  &:hover {
    opacity: 1;
  }
  &.showing {
    display: block;
  }
  &.podcast-pic-widget {
    a {
      color: var(--body-color);
    }
    .widget-body {
      padding-bottom: 10px;
    }
    .podcast-pic {
      display: flex;
      align-items: center;
      position: relative;
      padding: 5px 0px;
      border-top-left-radius: 100px;
      border-bottom-left-radius: 100px;
      border-top-right-radius: 5px;
      border-bottom-right-radius: 5px;
      img {
        visibility: visible;
        width: 23px;
        height: 23px;
        border-radius: 100px;
        vertical-align: -7px;
        margin-left: 3px;
      }
      .podcast-name {
        width: calc(100% - 55px);
        display: inline-block;
        padding-left: 4px;
        font-weight: bold;
        .podcast-name-inner {
          font-size: 14px;
          line-height: 15px;
          display: block;
          padding-left: 2px;
        }
      }
      &:hover {
        @include themeable(
          background,
          theme-container-background-hover,
          $light-gray
        );
      }
    }
  }
  hr {
    opacity: 0.2;
  }
  header,
  .widget--header {
    position: relative;
    font-size: 0.9em;
    font-weight: bold;
    padding: 8px 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier,
      monospace;
    color: var(--card-color);
    a {
      display: inline-block;
      color: var(--card-color);
      h4 {
        display: inline-block;
        margin: 0;
      }
      &:hover {
        text-decoration: underline;
      }
    }
    .emoji {
      margin-right: 6px;
      display: inline-block;
      vertical-align: -4px;
      img {
        width: 18px;
        border: 0px;
        cursor: default;
      }
    }
    .widget-listing-live-count {
      @include themeable(background, theme-secondary-color, $green);
      color: var(--base-inverted);
      border-radius: 3px;
      display: inline-block;
      font-size: 0.8em;
      padding: 1px 5px 0px;
      line-height: 1.4em;
    }

    .widget-minimize-button {
      position: absolute;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      background: transparent;
      padding: 0px 5px 1px;
      border-radius: 3px;
      font-size: 1.2em;
      line-height: 0.6em;
      @include themeable(
        border,
        theme-secondary-color-border,
        1px solid $light-medium-gray
      );
      @include themeable(
        color,
        theme-secondary-color,
        darken($light-medium-gray, 10%)
      );
    }
  }
  .widget-body {
    overflow-wrap: break-word;
    &.body-scrollable {
      height: calc(100vh - 300px);
      max-height: 390px;
      overflow-y: scroll;
    }

    &.widget-body--sponsorship-arbitrary img {
      width: 100%;
    }
    .widget-podcast-ep {
      padding-bottom: 8px;
      a {
        color: var(--body-color);
        font-weight: 500;
      }
    }
    .widget-podcast-title {
      margin-top: -2px;
      a {
        color: $medium-gray;
        font-size: 0.83em;
        opacity: 0.86;
      }
    }
    .widget-listing-link {
      @include sidebar-link;
      .widget-listing-link-title {
        display: block;
      }
      .widget-listing-link-category {
        display: inline-block;
        color: var(--card-color-tertiary);
        font-size: 0.8em;
        line-height: 1;
      }
    }
    .widget-accent {
      background: $purple;
      color: $bold-blue;
      padding: 1px 5px;
      border-radius: 3px;
      margin-right: 1px;
    }
    .widget-footer {
      color: $medium-gray;
      font-size: 0.9em;
      padding: 5px 0px 0px;
      img {
        height: 15px;
        width: 15px;
        vertical-align: -2px;
        display: inline;
        border: 0;
      }
    }
    .widget-subtext {
      padding: 0;
      margin: 0;
      color: var(--card-color-tertiary);
      font-size: 0.85em;
    }
    .widget-user-pic {
      display: inline-block;
      img {
        height: 48px;
        width: 48px;
        margin: 0 8px 8px 0;
        border-radius: 100%;
      }
    }

    // Listings
    .widget-listing-category {
      color: $medium-gray;
    }
    .widget-listing-title {
      font-family: var(--ff-sans-serif);
      font-weight: 500;
      margin-bottom: 8px;
    }
  }

  p {
    margin: 8px 0;
  }
  ul {
    padding-left: 10px;
    display: flex;
    flex-direction: column;
  }
  li {
    font-size: 1em;
    line-height: 1.32em;
    display: inline-block;
    &::before {
      font-size: 1.2em;
    }
  }

  ul {
    img {
      width: 5%;
      border: none;
      padding-right: 4px;
      visibility: hidden;
    }
  }
  a {
    &:hover {
      opacity: 0.9;
    }
  }
  .row {
    position: relative;
    overflow: hidden;
    padding: 1px 0px 3px;
    font-size: 0.97em;
    .key {
      float: left;
      width: 20px;
      font-size: 0.8em;
      padding: 2px;
    }
    .value {
      float: left;
      width: calc(100% - 42px);
      padding: 5px 7px;
    }
  }
}

.org-sidebar-widget {
  position: relative;
  overflow: hidden;
  display: block;

  .org-sidebar-widget-body {
    padding: 16px;
    overflow-wrap: break-word;
    &.body-scrollable {
      height: calc(100vh - 300px);
      max-height: 390px;
      overflow-y: scroll;
    }
    .org-sidebar-widget-user-pic {
      display: inline-block;
      img {
        height: 48px;
        width: 48px;
        margin: 3px;
        border-radius: 100%;
      }
    }
  }
  a {
    width: calc(100% - 40px);
    justify-content: center;
    &:hover {
      opacity: 0.9;
    }
  }
}

.org-member-page {
  .member-item {
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;

    .member-item-top {
      display: flex;
      width: 100%;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      gap: 12px;

      .member-user-pic {
        img {
          width: 48px;
          height: 48px;
          aspect-ratio: 1/1;
          margin: 3px;
          border-radius: 100%;
        }
      }
    }

    .member-item-bottom {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 1px;
      flex-grow: 0;

      .truncate {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
      }

      .member-username {
        font-weight: var(--fw-normal);
        font-size: var(--fs-s);
        line-height: var(--lh-base);
        letter-spacing: -0.02em;
        color: var(--color-secondary);
      }
    }
  }
}

.crayons-bb, .crayons-unit {
  padding: var(--su-3);
  padding-bottom: var(--su-4);

  &__header {
    width: 100%;
    display: flex;
    align-items: center;
  }

  &__title {
    color: var(--label-secondary);
    font-size: var(--fs-s);
    line-height: var(--lh-base);
    margin-left: var(--su-1);
    align-self: center;
  }

  &__dropdown {
    margin-left: auto;
  }

  img {
    height: auto;
    border-radius: var(--radius);
    display: inline-block;
    vertical-align: middle;
    align-self: center;
    background: var(--body-bg);
  }

  &__indicator {
    letter-spacing: -0.02em;
    text-transform: uppercase;
    align-self: center;
    word-wrap: normal;
    word-break: keep-all;
  }
  @media (min-width: $breakpoint-s) {
    &[data-browser-context="mobile_web"] {
      @media (min-width: $breakpoint-s) {
        display: none !important;
      }
    }
  }
}

.crayons-article-sticky,
.sidebar-wrapper {
  .crayons-card {
    .text-styles {
      font-size: var(--fs-base);
    }
  }
}

.crayons-article-sticky,
.sidebar-wrapper-left {
  .crayons-card {
    &.billboard, &.bb-placement {
      max-height: calc(
        100vh - var(--header-height) - 2 * var(--layout-padding)
      );
      overflow-y: auto;
    }
  }
}
